/*
 * @Author: Kyo 2539093612@qq.com
 * @Date: 2025-02-27 09:54:34
 * @LastEditors: Kyo 2539093612@qq.com
 * @LastEditTime: 2025-02-27 09:54:46
 * @FilePath: \作业\作业库\Note.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package 作业库;

public class Note {
    public static void main(String[] args) {
        //表头部分
        int i;
        for (i = 0; i < 38; i++) {
            if (i == 18) {
                System.out.print("商场内存清单");
            } else {
                System.out.print("-");
            }
        }
        System.out.println("\n品牌型号    尺寸    价格    库存数");

        // 表格中间部分
        String brand1 = "MacBookAir";
        double size1 = 13.3;
        double price1 = 5699.0;
        int stock1 = 5;

        String brand2 = "ThinkPadT490";
        double size2 = 14.0;
        double price2 = 8499.0;
        int stock2 = 10;

        String brand3 = "MateBook 14";
        double size3 = 14.0;
        double price3 = 7199.0;
        int stock3 = 18;

        System.out.printf("%-12s %.1f    %.1f    %d%n",brand1, size1, price1, stock1);
        System.out.printf("%-12s %.1f    %.1f    %d%n", brand2, size2, price2, stock2);
        System.out.printf( "%-12s %.1f    %.1f    %d%n",brand3, size3, price3, stock3);
        for (int b = 0; b < 49; b++) {
            
            System.out.print("-");
              }
        

        // 表格尾巴部分
        int totalStock = stock1 + stock2 + stock3;
        double totalAmount = (price1 * stock1) + (price2 * stock2) + (price3 * stock3);

        System.out.println("\n总库存数：" + totalStock);
        System.out.println("商品库存总金额：" + totalAmount);
    }
        
        }
    